home *** CD-ROM | disk | FTP | other *** search
- Path: news1.h1.usa.pipeline.com!usenet
- From: grantp@usa.pipeline.com(Pete)
- Newsgroups: comp.lang.c++
- Subject: Re: exception doesn't work with VC++ 2.2
- Date: 10 Jan 1996 20:59:38 GMT
- Organization: Pipeline USA
- Message-ID: <4d19bq$r8d@news1.usa.pipeline.com>
- NNTP-Posting-Host: pipe7.h1.usa.pipeline.com
- X-PipeUser: grantp
- X-PipeHub: usa.pipeline.com
- X-PipeGCOS: (Pete)
- X-Newsreader: Pipeline USA v3.3.0
-
- On Jan 10, 1996 20:06:47 in article <exception doesn't work with VC++ 2.2>,
- 'john@mrinc.com (John Matzen)' wrote:
-
-
- >I'm trying to update a record with the CRecordset::Update() function.
- >When I do, the function returns FALSE and the record is not updated.
-
- The documentation says that FALSE (0) indicates that no columns
- were changed. An exception is only thrown in case the number of
- records updated was something other than 1. FALSE may very well be
- the proper return value in your case.
-
- >I also can't seem to catch any exceptions from the function:
- >
- >In the following code block:
- >
- >try {
- > pDoc->setCustomer.Update();
- >}
- >catch (...) {
- > AfxMessageBox("An exception occured updating record.");
- >}
- >
- >the exception is not caught. Also, I've tried numerous variations of
- >this with try, and TRY, and catching specific exceptions and nothing
- >works. I have no idea why my record is not getting updated.
- >
- >Any ideas?
- >
- The exception mechanism works for me (See below). I'd say that
- CRecordset::Update method is not throwing an exception.
-
- #include <iostream.h>
-
- int test (int);
-
- int main ()
- {
- try
- {
- test (5);
- }
- catch (...)
- {
- cout << "Caught an exception.\n";
- return 1;
- }
- cout << "No exceptions caught.\n";
- return 0;
- }
-
-
- int test (int n)
- {
- if (n > 2)
- throw n;
- return n * 2;
- }
- /// returns "Caught an exception." on my machine.
-
- --
-
- Pete
-